package com.wunu.smartlock1.net.response;

import com.google.gson.annotations.SerializedName;

public class ApiNormalResponse<T> implements ApiResponse<ApiData<T>> {

    private int code;

    @SerializedName("error")
    private String errorMsg;

    private ApiData<T> data;

    public ApiData<T> getData() {
        return data;
    }

    public void setData(ApiData<T> data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public boolean ok(){
        return code == 0;
    }

    @Override
    public String toString() {
        return "ApiNormalResponse{" +
                "code=" + code +
                ", errorMsg='" + errorMsg + '\'' +
                ", data=" + data +
                '}';
    }
}
